当前位置:  开发笔记 > 编程语言 > 正文

`git add -p`的选项有哪些?

如何解决《`gitadd-p`的选项有哪些?》经验,为你挑选了1个好方法。

做一个git add -p我看到一个差异和选择列表:

~/workspace$ git add -p                                              
diff --git a/gulpfile.js b/gulpfile.js                                                 
index cf91028..c3a0964 100644                                                          
--- a/gulpfile.js                                                                      
+++ b/gulpfile.js                                                                      
@@ -57,7 +57,7 @@ gulp.task("pack", pack);                                             
 // Minify and concatenate all js libs                                                 
 gulp.task("libs", function() {                                                        
        return gulp.src([                                                              
-               "js/libs/trackjs.js",                                                  
+       //      "js/libs/trackjs.js",  // hidden due to noise but not the bug          
                "js/libs/q.js",                                                        
                "js/libs/jquery.js",                                                   
                "js/libs/cookie.js",                                                   
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?

什么Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?选项来?哪里可以找到他们的解释?



1> DaveyDaveDav..:

如果您?在提示符下键入,则会得到解释.

具体来说,选项是:

y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk or any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk or any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help

如果您遇到与我相同的困惑,我发现有时j,J,k,K选项不起作用,我认为(但没有足够的实验确定)它们只能在同一个文件中工作,所以你可以跳过相同的文件,但不会跳到下一个文件,然后回到上一个文件.

推荐阅读
携手相约幸福
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有